package com.magic.process.operator;

import com.magic.enums.MeetingEventEnum;
import com.magic.handler.MeetingHelper;
import com.magic.process.IMeetingOperator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author magic
 * @version 1.0
 * @date 2022/2/22 15:26
 */
@Slf4j
@Component
public class MeetingEmailOperator implements IMeetingOperator {
  private static List<MeetingEventEnum> excludeEventList = new ArrayList<>();

  static {
    excludeEventList.add(MeetingEventEnum.START);
  }
  @Override
  public Boolean support(MeetingEventEnum meetingEventEnum) {
    return !excludeEventList.contains(meetingEventEnum);
  }

  @Override
  public MeetingHelper[] beforeEvent(MeetingEventEnum meetingEventEnum, MeetingHelper... helpers) {
    if(meetingEventEnum.equals(MeetingEventEnum.END)){
      log.info("before会议结束MeetingEmailOperator");
    }else if(meetingEventEnum.equals(MeetingEventEnum.RESERVE)){
      log.info("before会议预定邮件MeetingEmailOperator");
    }
    return helpers;
  }

  @Override
  public MeetingHelper[] afterEvent(MeetingEventEnum meetingEventEnum, MeetingHelper... helpers ){
    if(meetingEventEnum.equals(MeetingEventEnum.END)){
      log.info("after会议结束MeetingEmailOperator");
    }else if(meetingEventEnum.equals(MeetingEventEnum.RESERVE)){
      log.info("after会议预定邮件MeetingEmailOperator");
    }
    return helpers;
  }
}
